<script setup lang="ts">
import { useUserStore } from '@/stores'
import { loginByPassword } from '@/api/user'
import { useRouter } from 'vue-router';
 
const router = useRouter();

const store = useUserStore()

const btn = async () => {
  const res = await loginByPassword()
}
const subMarb = () => {
  store.setUser({
    id: '1',
    mobile: '1',
    account: '1',
    avatar: '1',
    token: '1'
  })
  router.push('/');
}
</script>

<template>
  <p>{{ store.user }}</p>
  <button @click="subMarb">
    登录
  </button>
  <button @click="store.delUser()">退出</button>
  <button @click="btn">token</button>
</template>
